package com.ktjy.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ktjy.entity.SysUser;
import com.ktjy.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SysUserController {
    @Autowired
    ISysUserService sysUserService;

    @RequestMapping("/findAll")
    public Object findAll(){
        return sysUserService.findAll();
    }


    @RequestMapping("/selectAll")
    public Object selectAll(@RequestParam("usrRoleId") Long usrRoleId){
        //条件构造器
        LambdaQueryWrapper<SysUser> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(SysUser::getUsrRoleId, usrRoleId);

       List<SysUser> list= sysUserService.list(queryWrapper);
        return list;
    }

}
